<template>
  <div class="signUp-form">
    <h1>注册</h1>
    <v-text-field label="用户名" v-model="username"></v-text-field>
    <v-text-field label="密码" type="password" v-model="password"></v-text-field>
    <v-text-field label="邮箱" v-model="email"></v-text-field>
    <v-btn color="primary" @click="register()">注册</v-btn>
    <v-btn color="primary" text @click="signIn()">去登录</v-btn>
  </div>
</template>

<script>
/* eslint-disable camelcase */
export default {
  name: 'SignUp',
  data () {
    return {
      username: '',
      password: '',
      email: ''
    }
  },
  methods: {
    signIn () {
      console.log('let us go login')
      this.$router.push({ name: 'SignIn' })
    },
    register () {
      let post_data = {
        username: this.username,
        password: this.password,
        email: this.email,
      }
      this.$api.user.signUp(post_data).then(res => {
        console.log(res)
    })
    }
  }
}
</script>

<style scoped>
.signUp-form{
  width: 500px;
  margin: 0 auto;
  text-align: center;
}
</style>